﻿namespace NetFx.SMIL.References
{
  using System;
  using System.Text;
  using System.Collections;
  using System.Collections.Generic;

  using System.Reflection;
  using System.Reflection.Emit;
  using System.Runtime.InteropServices;

  using System.Diagnostics;
  using System.Diagnostics.CodeAnalysis;
  using System.Diagnostics.SymbolStore;
  using System.Security;
  using System.Security.Permissions;

  using NetFx.AGIL;

  /// <summary>
  /// 对计算的引用（常数封装）。
  /// </summary>
  public class CalculationRef:Reference
  {
    #region Statics
    public static CalculationRef of(Calculations? calc)
    {
      return new CalculationRef(calc);
    }
    #endregion
    #region Properties
    public virtual Calculations? Calculation
    {
      get
      {
        return this.Referenced as Calculations?;
      }
    }
    public virtual Calculations? ReflectInfo
    {
      get
      {
        return this.Calculation;
      }
    }
    public virtual bool HasReflectInfo
    {
      get
      {
        return this.ReflectInfo != null;
      }
    }

    #endregion
    #region Constructors
    public CalculationRef(Calculations? calc)
      : base(calc) 
    {
    }
    #endregion
    #region Methods
    public override string ToString()
    {
      return this.HasReflectInfo ?
        string.Format("{0}", this.Calculation.ToString()) :
        string.Format("{0}", Calculations.Unknown.ToString());
    }
    #endregion
  }
}
